Is it possible to create a link from DOORS Object to OLE Object in any Ms Office Application?I want to open the corresponding ole Object(any excel sheet cell,access table row or project task) using that link.
|
Re: Link between DOORS and OLE Object? Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Link between DOORS and OLE Object? |
Re: Link between DOORS and OLE Object? MF2G_qaus_qazah - Wed Jun 27 06:34:02 EDT 2012 |
Re: Link between DOORS and OLE Object? Here is my code
pragma runLim,0
//-------------- Global Declarations ------------------------//
DB dbDialog=create "Update from Access"
DBE dbeFilePath, dbeTable, dbeFieldName,dbeAttribute,dbeQuery
DBE dbeID
string attrNames[50]
int noOfAttrs=0
string an
string radioChoices[]={"Get","Set"}
//----------------------- build dialog ----------------------------//
DB buildDialog()
{
for an in attributes(current Module) do
{
attrNames[noOfAttrs]=an
//print "attrNames : " attrNames[noOfAttrs] "\tIndex : " noOfAttrs "\n"
noOfAttrs++
}
attrNames[noOfAttrs]="Object Text"
noOfAttrs++
attrNames[noOfAttrs]="Object Heading"
noOfAttrs++
dbeAttribute = choice(dbDialog, "Attribute: ", attrNames,noOfAttrs,0)
dbeFilePath=fileName (dbDialog,"Select File :","D:\\Sidrah\\PAKTES-1 Schedule")
return dbDialog
}
//---------------- Get Project Application Reference -----------------//
OleAutoObj GetAppObj()
{
OleAutoObj oleProjectApp = null
oleProjectApp=oleGetAutoObject("MSProject.Applicaion")
if(null oleProjectApp)
{
oleProjectApp = oleCreateAutoObject("MSProject.Application")
if (null oleProjectApp)
{
errorBox("Unable to open Project application")
}
}
return oleProjectApp
}
//------------------- Get Ms Project Object Reference ------------------//
OleAutoObj GetProject(OleAutoObj olePrjApp, string sFileName)
{
OleAutoObj oleProjects = null
OleAutoObj oleProject = null
OleAutoArgs autoArgs = create
string sProjectName= ""
string sAuthor = ""
put(autoArgs,sFileName)
oleMethod(olePrjApp,"FileOpenEx",autoArgs)
oleGet(olePrjApp,"Projects",autoArgs,oleProject)
if(null oleProject)
print "oleProject is null\n"
oleGet(oleProject,"Name",sProjectName)
print "Project Name : " sProjectName "\n"
oleGet(oleProject,"Author",sAuthor)
print "Project Author : " sAuthor "\n"
return oleProject
}
//----------------- Get Task Reference -----------------//
OleAutoObj GetTask(OleAutoObj oleProject, string wbs)
{
OleAutoObj oleTasks = null
OleAutoObj oleTask = null
OleAutoArgs autoArgs = create
int taskCount = 0
int i = 0
string taskName = ""
string taskWBS = ""
oleGet(oleProject,"Tasks",oleTasks)
oleGet(oleTasks,"Count",taskCount)
print "Tasks Count : " taskCount "\n"
print "Object WBS : " wbs "\n"
for(i=1;i<=taskCount;i++)
{
put(autoArgs,i)
oleGet(oleTasks,"Item",autoArgs,oleTask)
oleGet(oleTask,"Name",taskName)
oleGet(oleTask,"WBS",taskWBS)
if(taskWBS == wbs)
{
print "Task Name : " taskName "\nTask WBS : " taskWBS "\n"
clear autoArgs
return oleTask
}
clear autoArgs
}
}
//------------------- close Project Application -----------------//
void projectQuit(OleAutoObj oleProject)
{
oleMethod(oleProject,"Quit")
oleCloseAutoObject(oleProject)
}
//----------- link the current object to Ms Project Task ------------//
void linkMsProjectTask(DB dbDialog)
{
int x = 0
int y = 0
string sFilePath = get dbeFilePath
Object o = current
string wbs = o."WBS"
OleAutoObj olePrjApp = GetAppObj()
OleAutoObj oleProject = GetProject(olePrjApp,sFilePath)
OleAutoObj oleTask = GetTask(oleProject,wbs)
/*=== Want to create the link from Object "o"(Source) and OLE Object "oleTask"(Target) ===*/
projectQuit(olePrjApp)
refresh current Module
}
//--------------- call this function when OK button pressed ------------//
void callOK(DB dbDialog)
{
linkMsProjectTask(dbDialog)
}
//----------------- MAIN -------------------------//
dbDialog=buildDialog()
ok(dbDialog,"OK", callOK)
realize dbDialog
show dbDialog
|
Re: Link between DOORS and OLE Object? MF2G_qaus_qazah - Thu Jun 28 23:53:52 EDT 2012 Here is my code
pragma runLim,0
//-------------- Global Declarations ------------------------//
DB dbDialog=create "Update from Access"
DBE dbeFilePath, dbeTable, dbeFieldName,dbeAttribute,dbeQuery
DBE dbeID
string attrNames[50]
int noOfAttrs=0
string an
string radioChoices[]={"Get","Set"}
//----------------------- build dialog ----------------------------//
DB buildDialog()
{
for an in attributes(current Module) do
{
attrNames[noOfAttrs]=an
//print "attrNames : " attrNames[noOfAttrs] "\tIndex : " noOfAttrs "\n"
noOfAttrs++
}
attrNames[noOfAttrs]="Object Text"
noOfAttrs++
attrNames[noOfAttrs]="Object Heading"
noOfAttrs++
dbeAttribute = choice(dbDialog, "Attribute: ", attrNames,noOfAttrs,0)
dbeFilePath=fileName (dbDialog,"Select File :","D:\\Sidrah\\PAKTES-1 Schedule")
return dbDialog
}
//---------------- Get Project Application Reference -----------------//
OleAutoObj GetAppObj()
{
OleAutoObj oleProjectApp = null
oleProjectApp=oleGetAutoObject("MSProject.Applicaion")
if(null oleProjectApp)
{
oleProjectApp = oleCreateAutoObject("MSProject.Application")
if (null oleProjectApp)
{
errorBox("Unable to open Project application")
}
}
return oleProjectApp
}
//------------------- Get Ms Project Object Reference ------------------//
OleAutoObj GetProject(OleAutoObj olePrjApp, string sFileName)
{
OleAutoObj oleProjects = null
OleAutoObj oleProject = null
OleAutoArgs autoArgs = create
string sProjectName= ""
string sAuthor = ""
put(autoArgs,sFileName)
oleMethod(olePrjApp,"FileOpenEx",autoArgs)
oleGet(olePrjApp,"Projects",autoArgs,oleProject)
if(null oleProject)
print "oleProject is null\n"
oleGet(oleProject,"Name",sProjectName)
print "Project Name : " sProjectName "\n"
oleGet(oleProject,"Author",sAuthor)
print "Project Author : " sAuthor "\n"
return oleProject
}
//----------------- Get Task Reference -----------------//
OleAutoObj GetTask(OleAutoObj oleProject, string wbs)
{
OleAutoObj oleTasks = null
OleAutoObj oleTask = null
OleAutoArgs autoArgs = create
int taskCount = 0
int i = 0
string taskName = ""
string taskWBS = ""
oleGet(oleProject,"Tasks",oleTasks)
oleGet(oleTasks,"Count",taskCount)
print "Tasks Count : " taskCount "\n"
print "Object WBS : " wbs "\n"
for(i=1;i<=taskCount;i++)
{
put(autoArgs,i)
oleGet(oleTasks,"Item",autoArgs,oleTask)
oleGet(oleTask,"Name",taskName)
oleGet(oleTask,"WBS",taskWBS)
if(taskWBS == wbs)
{
print "Task Name : " taskName "\nTask WBS : " taskWBS "\n"
clear autoArgs
return oleTask
}
clear autoArgs
}
}
//------------------- close Project Application -----------------//
void projectQuit(OleAutoObj oleProject)
{
oleMethod(oleProject,"Quit")
oleCloseAutoObject(oleProject)
}
//----------- link the current object to Ms Project Task ------------//
void linkMsProjectTask(DB dbDialog)
{
int x = 0
int y = 0
string sFilePath = get dbeFilePath
Object o = current
string wbs = o."WBS"
OleAutoObj olePrjApp = GetAppObj()
OleAutoObj oleProject = GetProject(olePrjApp,sFilePath)
OleAutoObj oleTask = GetTask(oleProject,wbs)
/*=== Want to create the link from Object "o"(Source) and OLE Object "oleTask"(Target) ===*/
projectQuit(olePrjApp)
refresh current Module
}
//--------------- call this function when OK button pressed ------------//
void callOK(DB dbDialog)
{
linkMsProjectTask(dbDialog)
}
//----------------- MAIN -------------------------//
dbDialog=buildDialog()
ok(dbDialog,"OK", callOK)
realize dbDialog
show dbDialog
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |